<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.prime.com.tr/ui">

 <ui:composition template="/template/DefaultTemplate.xhtml">
        <ui:define name="top">

    </ui:define>

    <ui:define name="left">

    </ui:define>
        <ui:define name="content">
          
<h:form id="form"  >    
  
     <h:commandButton action ="ViewRole?faces-redirect=true" value="Return"/>
     <br />
      
   <p:dataTable  id ="list" value="#{RoleController.list}" var="role" widgetVar="Table"
                                      paginator="true" rows="10"  
                                      paginatorTemplate="{FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink}"
                                      selection="#{RoleController.selectedRole}" selectionMode="single"
                                      rowSelectListener="#{RoleController.roleSelect}" > 
            <p:column sortBy="#{role.rightName}" filterBy="#{role.rightName}">  
                <f:facet name="header">  
                    <h:outputText value="#{RoleController.selectedUser.name}'s Roles" />  
                </f:facet>  
                <h:outputText value="#{role.roleName}" />  
            </p:column>  
      
        </p:dataTable>  
    <br/>
     <p:pickList value="#{RoleController.rolesPickList}"  
                            var="item"  
                            itemLabel="#{item}"  
                            itemValue="#{item}">
                    <f:facet name="sourceCaption">All Roles</f:facet>  
                    <f:facet name="targetCaption">#{RoleController.selectedUser.name}'s Roles</f:facet>
                </p:pickList>

                    <p:commandButton ajax="false" value="Assign Roles" action ="#{RoleController.updateUserRoles}"/>
<br/>
<br></br> 

           
</h:form>    
             </ui:define>
       </ui:composition>
    
  

</html>